import type { BaseTableConfig } from '@/components/base-ui/base-table/type';
import { generateRandomId, InputType } from '@/utils';

export const tableConfig: BaseTableConfig = {
    items: [
        {
            modelKey: 'orderNumber',
            columnProps: {
                label: '订单号',
                width: 260
            },
            elInputProps: {
                showWordLimit: true,
                clearable: false,
                maxlength: '50'
            },
            validProps: {
                id: generateRandomId(),
                required: true
            },
            validFormatType: InputType.NUMERIC_ALPHABET_SYMBOLS
        },
        {
            itemType: 'select',
            modelKey: 'itemCode',
            slotName: 'itemCode',
            columnProps: {
                label: '物料编码',
                width: 180
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },
        {
            itemType: 'text',
            modelKey: 'itemName',
            columnProps: {
                label: '物料名称',
                width: 180
            },
            elInputProps: {
                disabled: true
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },
        {
            itemType: 'select',
            modelKey: 'customerCode',
            slotName: 'customerCode',
            columnProps: {
                label: '客户编码',
                width: 180
            },
            validProps: {
                id: generateRandomId()
            }
        },
        {
            itemType: 'text',
            modelKey: 'customerCompanyName',
            columnProps: {
                label: '客户公司名称',
                width: 180
            },
            elInputProps: {
                disabled: true
            },
            validProps: {
                id: generateRandomId()
            }
        },
        {
            itemType: 'date',
            modelKey: 'orderDate',
            elDatePickerProps: {
                valueFormat: 'YYYY-MM-DD'
            },
            columnProps: {
                label: '下单日期',
                width: 180
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },
        {
            itemType: 'date',
            modelKey: 'orderDeliveryDate',
            elDatePickerProps: {
                valueFormat: 'YYYY-MM-DD'
            },
            columnProps: {
                label: '订单交期',
                width: 180
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },
        {
            itemType: 'number',
            modelKey: 'orderQuantity',
            elInputNumberProps: {
                max: 9999999,
                min: 1,
                precision: 0
            },
            columnProps: {
                label: '产品数量',
                width: 180
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },
        {
            itemType: 'select',
            modelKey: 'orderPriority',
            default: '5',
            elSelectProps: {
                options: [
                    { label: '1', value: '1' },
                    { label: '2', value: '2' },
                    { label: '3', value: '3' },
                    { label: '4', value: '4' },
                    { label: '5', value: '5' },
                    { label: '6', value: '6' },
                    { label: '7', value: '7' },
                    { label: '8', value: '8' },
                    { label: '9', value: '9' },
                    { label: '10', value: '10' }
                ]
            },
            columnProps: {
                label: '订单优先级',
                width: 180
            },
            validProps: {
                id: generateRandomId(),
                required: true
            },
            otherConfig: {
                tip: true,
                tipMsg: '优先级越高，数字越小。'
            }
        }
    ],
    unAction: true
};
